<template>
  <a-modal
    :title="$t('新增商品')"
    :width="width"
    :visible="visible"
    :confirmLoading="confirmLoading"
    @cancel="handleCancel"
    :cancelText="$t('关闭')"
    v-drag
  >
    <template slot="footer">
      <a-button @click="handleCancel">{{ $t('取消') }}</a-button>
    </template>
    <a-spin :spinning="confirmLoading">
      <div>
        <a-row :gutter="24">
          <a-col
            :span="9"
            class="top-col"
            @click="handleAdd(item.value)"
            v-for="(item, indexs) in list"
            :key="indexs"
            >{{ item.title }}</a-col
          >
        </a-row>
      </div>
    </a-spin>
    <tickets-modal ref="modalForm" @ok="modalFormOk"></tickets-modal>
  </a-modal>
</template>

<script>
import TicketsModal from '../../goods/modules/TicketsModal'

export default {
  name: 'TicketsSettingModal',
  components: {
    TicketsModal,
  },
  data() {
    return {
      width: 500,
      visible: false,
      model: {},
      confirmLoading: false,
      dataForm: {
        goodsId: '',
      },
      treeData: [],
      allChildKind: [],
      goodsList: [],
      value: '',
      list: [
        {
          title: this.$t('次票'),
          value: 3,
        },
        {
          title: this.$t('年票'),
          value: 4,
        },
      ],
    }
  },
  methods: {
    edit() {
      this.visible = true
    },
    handleAdd(state) {
      this.$refs.modalForm.add(state)
      this.$refs.modalForm.title = this.$t('新增')
      this.$refs.modalForm.disableSubmit = false
    },
    modalFormOk() {
      this.close()
      this.$emit('ok')
    },
    handleCancel() {
      this.close()
    },
    close() {
      this.visible = false
    },
  },
}
</script>
<style>
.top-col {
  text-align: center;
  height: 60px;
  line-height: 60px;
  border-radius: 5px;
  margin: 0 20px 15px 20px;
  font-size: 16px;
  color: #ffff;
  background-color: #eb5467;
}
</style>